from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
import os
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    launch_file = os.path.join(get_package_share_directory('uav_swarms'), 'launch', 'communication_multirotor_node_launch.py')

    # 定义多个实例，每个实例的参数不同
    return LaunchDescription([
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(launch_file),
            launch_arguments={'vehicle_ids': '0'}.items()
        ),
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(launch_file),
            launch_arguments={'vehicle_ids': '1'}.items()
        ),
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(launch_file),
            launch_arguments={'vehicle_ids': '2'}.items()
        ),
    ])
